package org.ycy.data.generator.core;

import org.ycy.data.generator.entity.TemplateConfig;
import org.ycy.data.generator.sink.FileSink;
import org.ycy.data.generator.sink.Sink;
import org.ycy.data.generator.sink.SqlSink;

/**
 * @program: data-generator
 * @ClassName SinkFactory
 * @description:
 * @author: ycy
 * @create: 2023-06-16 22:48
 * @Version 1.0
 **/
public class SinkFactory {

    public static Sink builderSink(TemplateConfig templateConfig) {

        switch (templateConfig.getStoreType()) {
            case DATABASE:
                return new SqlSink(templateConfig);
            case EXCEL:
                throw new RuntimeException("暂不支持存储类型:" + templateConfig.getStoreType());
            default:
                return new FileSink(templateConfig);
        }
    }
}